<?php
    namespace Home\Controller;
    use Think\Controller;
    class ComplainController extends Controller{
        public function index(){
            $this->display();
        }
        public function atc(){
            $this->display();
        }
        function chekgdlb() {//按查询条件查投诉表
            $glxq = new \Npfe\Model\GlxqModel();  
            $st = $_POST['starttime'];
            $et = $_POST['endtime'];
            $lxnumber = I('post.lxnumber');
            $data = array();
            //$this->now_root = $MEMBER->getroot($now_user);
            $pushtable = array();
            if ($lxnumber!='') {
                $data = $glxq->where("contactnumber='$lxnumber' AND gdlbvalue != '激活卡申请'")->select();
            }else {
                $data = $glxq->where("time>='$st' AND time
                    <='$et' AND gdlbvalue != '激活卡申请'")->select();
            }
            foreach($data as $row){
                $row['fwnr'] = '
                <input name="vgd" type="button" value="查看" onclick="viewgd(\''.$row['contactnumber'].'\',\''.$row['time'].'\')"/>
                '; 
                $pushtable[] = $row;
            }
            $jsonr = array(
                'total' => count($pushtable),
                'rows' => $pushtable
            );
            $this->ajaxReturn(json_encode($jsonr));
        }
        function chekjhlb() { //按时间范围查激活卡表
            $glxq = new \Npfe\Model\GlxqModel();  
            $st = $_POST['starttime'];
            $et = $_POST['endtime'];
            $lxnumber = I('post.lxnumber');
            $data = array();
            //$this->now_root = $MEMBER->getroot($now_user);
            $pushtable = array();
            if ($lxnumber!='') {
                $data = $glxq->where("contactnumber='$lxnumber' AND gdlbvalue = '激活卡申请'")->select();
            }else {
                $data = $glxq->where("time>='$st' AND time
                    <='$et' AND gdlbvalue = '激活卡申请'")->select();
            }
            foreach($data as $row){
                $row['fwnr'] = '
                <input name="vgd" type="button" value="查看" onclick="viewgd(\''.$row['contactnumber'].'\',\''.$row['time'].'\')"/>
                '; 
                $pushtable[] = $row;
            }
            $jsonr = array(
                'total' => count($pushtable),
                'rows' => $pushtable
            );
            $this->ajaxReturn(json_encode($jsonr));
        }
    }
